﻿Imports System
Imports System.Collections.ObjectModel
Imports System.Workflow.ComponentModel
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.Activities
    <ActivityDesignerTheme(GetType(StateFinalizationDesignerTheme))> _
    Friend NotInheritable Class StateFinalizationDesigner
        Inherits SequenceDesigner
        ' Methods
        Public Overrides Function CanBeParentedTo(ByVal parentActivityDesigner As CompositeActivityDesigner) As Boolean
            If (parentActivityDesigner Is Nothing) Then
                Throw New ArgumentNullException("parentActivityDesigner")
            End If
            Return (TypeOf parentActivityDesigner.Activity Is StateActivity AndAlso MyBase.CanBeParentedTo(parentActivityDesigner))
        End Function

        Public Overrides Function CanInsertActivities(ByVal insertLocation As HitTestInfo, ByVal activitiesToInsert As ReadOnlyCollection([Of] Activity)) As Boolean
            Dim activity As Activity
            For Each activity In activitiesToInsert
                If TypeOf activity Is IEventActivity Then
                    Return False
                End If
            Next
            Return MyBase.CanInsertActivities(insertLocation, activitiesToInsert)
        End Function

        Protected Overrides Sub DoDefaultAction()
            MyBase.DoDefaultAction
            MyBase.EnsureVisible
        End Sub


        ' Properties
        Public Overrides ReadOnly Property CanExpandCollapse As Boolean
            Get
                Return False
            End Get
        End Property

    End Class
End Namespace

